package com.yowasa.xiuxian.engine.item.danyao;

import com.yowasa.xiuxian.annoations.Item;
import com.yowasa.xiuxian.engine.item.ItemInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.entity.enums.ItemTypeEnum;
import com.yowasa.xiuxian.exception.HandlerException;

import java.text.MessageFormat;


@Item(name = "琅琊果", type = ItemTypeEnum.DAN_YAO, price = 2000)
public class LangYaGuo implements ItemInterface {

    @Override
    public String desc() {
        return "提高金灵根占比，归离原奇遇获取";
    }

    @Override
    public String effect(UserBO userBO) {
        String ele = ElementEnum.GOLD.getName();
        String against = ElementEnum.GOLD.getAgainst().getName();
        if (userBO.getElement().get(against) < 2) {
            throw new HandlerException(MessageFormat.format("你的{0}灵根已经到达最低值，无法继续降低了,提升{1}灵根失败",against,ele));
        }
        userBO.getElement().put(against, userBO.getElement().get(against) - 1);
        userBO.getElement().put(ele, userBO.getElement().get(ele) + 1);
        return "你的感觉你对金属性感悟提高了";

    }


}

